﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace WanPiJie.WebSite
{
	public class PageMustLogin_Baby : PageMustLogin
	{
		public Baby Baby { get; set; }

		/// <summary>
		/// 是否有Baby。
		/// </summary>
		protected bool HasBaby
		{
			get { return this.Baby != null; }
		}

		protected override void OnInit(EventArgs e)
		{
			base.OnInit(e);

			var babies = WpjSf.BabyService.GetBabies(LoginUser.Id);
			if (babies.Count > 0)
			{
				babies.OrderByDescending(p => p.Birthday);
				this.Baby = babies[0];
			}
		}
	}
}